package com.audi.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.audi.R;

public class AddActionCardAdapter extends BaseAdapter {
	private Activity mActivity;
	private ArrayList<String> mArrTrigger;

	int posit;

	public AddActionCardAdapter(Activity activity,
			ArrayList<String> mListTriggerArr) {
		this.mActivity = activity;
		this.mArrTrigger = mListTriggerArr;
	}

	private class ViewHolder {
		TextView txtWhen;

	}

	@Override
	public int getCount() {
		return mArrTrigger.size();
	}

	@Override
	public Object getItem(int arg0) {
		return mArrTrigger.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final ViewHolder holder;
		// posit=position;
		LayoutInflater mInflater = (LayoutInflater) mActivity
				.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);

		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.device_action_condition,
					null);
			holder = new ViewHolder();
			holder.txtWhen = (TextView) convertView.findViewById(R.id.action_name);

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		// /DescriptionSmartTrigger rowItem = (DescriptionSmartTrigger)
		// getItem(position);

		holder.txtWhen.setText(mArrTrigger.get(position));

		return convertView;
	}
}
